f = open('log.txt', 'a')
try:
    f.write('\nhahahaha')
except IOError as e:
    print('写入文件报错', e)
else:
    print('写入成功')
finally:
    f.close()

# try-except
# try-except-else
# try-finally


try:

    print('1')
except ArithmeticError:
    print('0')
except Exception:
    print('00')
else:
    print('2')
finally:
    print('3')

# a- 1 3
# b- 1 2 3
# c- 1 0 00 3
# d- 1 2
